# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.FirebaseHosting.V1beta1.Model.Rewrite do
  @moduledoc """
  A [`Rewrite`](https://firebase.google.com/docs/hosting/full-config#rewrites) specifies a URL pattern that, if matched to the request URL path, triggers Hosting to respond as if the service were given the specified destination URL.

  ## Attributes

  *   `dynamicLinks` (*type:* `boolean()`, *default:* `nil`) - The request will be forwarded to Firebase Dynamic Links.
  *   `function` (*type:* `String.t`, *default:* `nil`) - The function to proxy requests to. Must match the exported function name exactly.
  *   `functionRegion` (*type:* `String.t`, *default:* `nil`) - Optional. Specify a Cloud region for rewritten Functions invocations. If not provided, defaults to us-central1.
  *   `glob` (*type:* `String.t`, *default:* `nil`) - The user-supplied [glob](https://firebase.google.com/docs/hosting/full-config#glob_pattern_matching) to match against the request URL path.
  *   `path` (*type:* `String.t`, *default:* `nil`) - The URL path to rewrite the request to.
  *   `regex` (*type:* `String.t`, *default:* `nil`) - The user-supplied RE2 regular expression to match against the request URL path.
  *   `run` (*type:* `GoogleApi.FirebaseHosting.V1beta1.Model.CloudRunRewrite.t`, *default:* `nil`) - The request will be forwarded to Cloud Run.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :dynamicLinks => boolean() | nil,
          :function => String.t() | nil,
          :functionRegion => String.t() | nil,
          :glob => String.t() | nil,
          :path => String.t() | nil,
          :regex => String.t() | nil,
          :run => GoogleApi.FirebaseHosting.V1beta1.Model.CloudRunRewrite.t() | nil
        }

  field(:dynamicLinks)
  field(:function)
  field(:functionRegion)
  field(:glob)
  field(:path)
  field(:regex)
  field(:run, as: GoogleApi.FirebaseHosting.V1beta1.Model.CloudRunRewrite)
end

defimpl Poison.Decoder, for: GoogleApi.FirebaseHosting.V1beta1.Model.Rewrite do
  def decode(value, options) do
    GoogleApi.FirebaseHosting.V1beta1.Model.Rewrite.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.FirebaseHosting.V1beta1.Model.Rewrite do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
